package com.olocat.cjx.nsims.pojo.permission

import javax.persistence.*

@Entity
@Embeddable
@Table(name = "role")
class Role {
    @Id
    @Column(name = "id")
    var id: String? = null
    var name: String? = null
    var describe: String? = null
    var status: Int? = null
    var creatorId: String? = null
    var createTime: Long? = null
    var delete: Byte? = null

    @OneToMany(cascade = [CascadeType.ALL], fetch = FetchType.LAZY)
    @JoinColumn(name = "role_id")
    var permissions: List<Permission>? = null

    override fun toString(): String {
        return "Role{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", describe='" + describe + '\'' +
                ", status=" + status +
                ", creatorId='" + creatorId + '\'' +
                ", createTime=" + createTime +
                ", delete=" + delete +
                ", permissions=" + permissions +
                '}'
    }
}